package com.wyzt.item.service;

import com.wyzt.common.enums.ExceptionEnum;
import com.wyzt.common.exception.WyztException;
import com.wyzt.item.mapper.SpecificationMapper;
import com.wyzt.item.pojo.Specification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SpecificationService {

    @Autowired
    private SpecificationMapper specificationMapper;

    /**
     * 查询分类规格模板
     * @param id
     * @return
     */
    public String querySpecifications(Long id) {
        Specification specification = specificationMapper.selectByPrimaryKey(id);
        if (specification == null) {
            throw new WyztException(ExceptionEnum.SPEC_NOT_FOUND);
        }
        return specification.getSpecifications();
    }
}
